/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package suministros.ejb30.interceptors;

import java.lang.reflect.Field;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.PostPersist;

/**
 *
 * @author Renato
 */
public class EntityBeanLifecycleInterceptor {
    Object objeto;


    @PostPersist
    public void postpersist(Object c) {
        Field[] campos=c.getClass().getDeclaredFields();

        System.out.println("post persist " + c);
        
        for(int i=0;i<campos.length;i++){
            campos[i].setAccessible(true);
            try {
                System.out.println("Campo " + campos[i].getName() + " -valor:" + campos[i].get(null).toString());
            } catch (IllegalArgumentException ex) {
                ex.printStackTrace();
                Logger.getLogger(EntityBeanLifecycleInterceptor.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                ex.printStackTrace();
                Logger.getLogger(EntityBeanLifecycleInterceptor.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

    }



}
